//
// DRV8311P_CONFIG.H
// Created by Xiaoyun on 2023/3/27.
//

#ifndef FOC_DRV8311P_CONFIG_H
#define FOC_DRV8311P_CONFIG_H

#include <stdint.h>

/*-------------------DRV_ADC-------------------*/

#define DRV_ADC_QUEUE_LEN   (1u)   // Window width of Mean sampling, must greater than 1 , Tconv=2.5us/channel(in adc.c), total Tconv_all=N_ADC_CHANNEL*F_ADC_CHANNEL*Tconv, is called in drv8311p.c
/// \brief <b> DRV ADC Channels enum</b>
typedef enum {
  DRV_C_SOA = 0U,
  DRV_C_SOB,
  DRV_C_SOC,
  DRV_C_BAT,
  N_ADC_CHANNEL   // Number of ADC channels, is called in drv8311p.c
} DRV_Channel_ADC;


/*-------------------DRV_SPI-------------------*/

#define DRV_DEVICE_GENERAL_CALL_ID (0xf)
#define DRV_DEVICE_ID_0 (0x0)
#define DRV_DEVICE_ID_1 (0x1)
#define DRV_DEVICE_ID_2 (0x2)
#define DRV_DEVICE_ID_3 (0x3)


/*-------------------User Definition(Used outside drv8311 files)-------------------*/

#define DRV_PWM_PRD_T (2000/2) // 20M/[2000]=10k,Up/Down Mode[/2],Up Mode[/1],Down Mode[/1]
#define DRV_ADC_RESOLUTION 4096
#define ADC_REF_VALUE (4030.f)
#define ADC_REF_V (3.325f)
#define DRV_ADC_BASE_A  (1981)
#define DRV_ADC_BASE_B  (1978)
#define DRV_ADC_BASE_C  (1989)

#endif //FOC_DRV8311P_CONFIG_H
